package is.api.demo.rest.core;

import java.io.Serializable;
import java.util.Map;

public class HttpServiceResult implements Serializable, Cloneable {
    //返回数据业务节点
    private Object result;

    public HttpServiceResult(Object result) {
        this.result = result;
    }

    public String getString() {
        return result.toString();
    }

    public String getString(String key) {
        return getObject(key).toString();
    }

    public Object getObject(String key) {
        return ((Map) result).get(key);
    }

    public Integer getInteger(String key) {
        return Integer.valueOf(getObject(key).toString());
    }

    @SuppressWarnings("unchecked")
    public <T> T getList(String key) {
        return (T) getObject(key);
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }
}
